import operate from '@dfeidao/atom-nodejs/db/operate';
import log from '@dfeidao/atom-nodejs/logger/log';
import { IncomingHttpHeaders } from 'http';
import { systemid } from '../../atom/config';

interface Message {
	staff_no: string;
	headimg: string;
	productid: string;
}

export default async function atom(message: Message, action_id: string, session_id: string, headers: IncomingHttpHeaders) {
	log('Service begin path:mine-purse/zj-000004/s001,action_id:' + action_id);
	const { update, exec } = operate(action_id, session_id, systemid);
	update('emp_information', { staff_no: message.staff_no, productid: message.productid }, { headimg: message.headimg });
	const ret = await exec();
	log('Service end path:mine-purse/zj-000004/s001,action_id:' + action_id);
	return { data: ret };
}
